Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(un)stage directory #600

Merged
merged 3 commits into from
Jan 2, 2019
Merged

(un)stage directory #600

merged 3 commits into from
Jan 2, 2019

Conversation

UziTech
Copy link
Contributor

@UziTech UziTech commented Dec 18, 2018

Add stageDirectory and unstageDirectory commands to (un)stage entire folder in tree view

fixes #599

@UziTech
Copy link
Contributor Author

UziTech commented Dec 18, 2018

This is just a start to the PR to get an idea of how to do it.

I am new to vscode and have never created/edited an extension before, so constructive criticism is appreciated.

If this is not the right direction feel free to close this PR

const fileNodes: (CommitFileNode | StatusFileNode)[] = [];

for (const fileNode of fileNodes) {
void (await this.stageFile(fileNode));
Copy link
Contributor Author

@UziTech UziTech Dec 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if staging each file individually is the way to do it or if there is a way to pass a directory path to Container.git.stageFile.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would recommend adding a stageDirectory method to GitService, and it could call the same underlying Git.add method since the fileName parameter can really be a pathspec (and probably should be renamed)

See here: https://git-scm.com/docs/git-add#git-add-ltpathspecgt82308203

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And similar should be true for unstaging -- Git.reset can take a set of paths (although not a pathspec)

See here: https://git-scm.com/docs/git-reset#git-reset-emgitresetem-qlttree-ishgt--ltpathsgt82308203

@eamodio
Copy link
Member

eamodio commented Dec 22, 2018

@UziTech Thanks for the PR! Looks like you are on the right track and should hopefully be straight forward to finish it up. Let me know if you have any other questions. (And sorry for the delay in responding)

@UziTech UziTech changed the title WIP: stage directory (un)stage directory Dec 23, 2018
@UziTech
Copy link
Contributor Author

UziTech commented Dec 23, 2018

I think this should work. I'm not sure how to test it. Is there a way to install local extensions in vscode?

@eamodio
Copy link
Member

eamodio commented Dec 24, 2018

You can build/package everything by running npm run pack. That will generate a vsix, which you can install in vscode. From the ... menu on the Extensions side bar, choose Install from VSIX...

But you should be able to test it much easier than all that. You can run npm run watch (or just hit Ctrl+Shift+B in vscode) and then hit F5 in vscode and it will launch another vscode instance where you can easily debug GitLens.

@UziTech
Copy link
Contributor Author

UziTech commented Dec 27, 2018

For some reason I keep getting an error when running npm run pack

ERROR in ./src/vsls/vsls.ts
Module not found: Error: Can't resolve 'vsls' in 'C:\Users\tjbrix\Documents\projects\GitHub\vscode-gitlens\src\vsls'

even though vsls is in the node_modules folder.

I tried it in the master branch and get the same error

@eamodio
Copy link
Member

eamodio commented Dec 27, 2018

@UziTech Ugh sorry about that. Because of issues with the vsls package I was relying on hand-edits. I have made changes to the webpack.config.js that will automatically apply the edits (if needed) when you run npm run build, npm run watch, etc. That should resolve the issues you are experiencing.

Just rebase your changes onto the develop branch and the build issues should be resolved.

@eamodio
Copy link
Member

eamodio commented Dec 27, 2018

Please also change the base of your PR from master to develop

@eamodio
Copy link
Member

eamodio commented Dec 27, 2018

@UziTech FYI, I added a CONTRIBUTING.md file that may help as well.

@UziTech UziTech changed the base branch from master to develop December 27, 2018 16:08
@UziTech
Copy link
Contributor Author

UziTech commented Dec 27, 2018

I rebased on develop, tested it with the debugger and everything seems to be working. 🎉

image

@ragvri
Copy link

ragvri commented Dec 28, 2018

@UziTech, you are doing God's work here. I wanted this feature since eons. Hopefully, it will be merged :)

@eamodio eamodio merged commit 6b60917 into gitkraken:develop Jan 2, 2019
@eamodio
Copy link
Member

eamodio commented Jan 2, 2019

@UziTech This has been released as part of GitLens 9.3 -- thanks for your contribution!

FYI, I made some minor changes, to restrict the commands to only show up for working tree folders and also added the commands to the inline toolbar

@UziTech UziTech deleted the stageDirectory branch January 2, 2019 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants